﻿namespace TestTool.Tests.Definitions.Features
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;
    using TestTool.Tests.Definitions.Enums;

    public class FeaturesSet
    {
        private FeaturesSet()
        {
            this.Nodes = new List<FeatureNode>();
        }

        public static FeaturesSet CreateFeaturesSet()
        {
            FeaturesSet set = new FeaturesSet();
            FeatureNode item = new FeatureNode {
                Name = "Security",
                Feature = Feature.Security,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            set.Nodes.Add(item);
            FeatureNode node90 = new FeatureNode {
                Name = "WSU",
                Feature = Feature.WSU
            };
            item.Nodes.Add(node90);
            FeatureNode node91 = new FeatureNode {
                Name = "Digest",
                Feature = Feature.Digest
            };
            item.Nodes.Add(node91);
            FeatureNode node2 = new FeatureNode {
                Name = "Discovery",
                Feature = Feature.Discovery,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            set.Nodes.Add(node2);
            FeatureNode node93 = new FeatureNode {
                Name = "BYE",
                Feature = Feature.BYE
            };
            node2.Nodes.Add(node93);
            FeatureNode node3 = new FeatureNode {
                Name = "DeviceService",
                Feature = Feature.DeviceService,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            set.Nodes.Add(node3);
            FeatureNode node4 = new FeatureNode {
                Name = "Capabilities",
                Feature = Feature.Capabilities,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            node3.Nodes.Add(node4);
            FeatureNode node96 = new FeatureNode {
                Name = "GetCapabilities",
                Feature = Feature.GetCapabilities
            };
            node4.Nodes.Add(node96);
            FeatureNode node97 = new FeatureNode {
                Name = "GetServices",
                Feature = Feature.GetServices
            };
            node4.Nodes.Add(node97);
            FeatureNode node5 = new FeatureNode {
                Name = "Network",
                Feature = Feature.Network,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            node3.Nodes.Add(node5);
            FeatureNode node99 = new FeatureNode {
                Name = "ZeroConfiguration",
                Feature = Feature.ZeroConfiguration
            };
            node5.Nodes.Add(node99);
            FeatureNode node100 = new FeatureNode {
                Name = "NTP",
                Feature = Feature.NTP
            };
            node5.Nodes.Add(node100);
            FeatureNode node101 = new FeatureNode {
                Name = "IPv6",
                Feature = Feature.IPv6
            };
            node5.Nodes.Add(node101);
            FeatureNode node102 = new FeatureNode {
                Name = "DHCPv6",
                Feature = Feature.DHCPv6
            };
            node5.Nodes.Add(node102);
            FeatureNode node103 = new FeatureNode {
                Name = "DynamicDNS",
                Feature = Feature.DynamicDNS
            };
            node5.Nodes.Add(node103);
            FeatureNode node104 = new FeatureNode {
                Name = "IPFilter",
                Feature = Feature.IPFilter
            };
            node5.Nodes.Add(node104);
            FeatureNode node6 = new FeatureNode {
                Name = "System",
                Feature = Feature.System,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            node3.Nodes.Add(node6);
            FeatureNode node7 = new FeatureNode {
                Name = "SystemLog",
                Feature = Feature.SystemLogging
            };
            node6.Nodes.Add(node7);
            FeatureNode node8 = new FeatureNode {
                Name = "DeviceIo",
                Feature = Feature.DeviceIO,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            node3.Nodes.Add(node8);
            FeatureNode node9 = new FeatureNode {
                Name = "DeviceIoRelayOutputs",
                Feature = Feature.DeviceIORelayOutputs
            };
            node8.Nodes.Add(node9);
            FeatureNode node10 = new FeatureNode {
                Name = "DeviceIoRelayOutputsBistable",
                Feature = Feature.DeviceIORelayOutputsBistable
            };
            FeatureNode node11 = new FeatureNode {
                Name = "DeviceIoRelayOutputsBistableOpen",
                Feature = Feature.DeviceIORelayOutputsBistableOpen
            };
            FeatureNode node12 = new FeatureNode {
                Name = "DeviceIoRelayOutputsBistableClosed",
                Feature = Feature.DeviceIORelayOutputsBistableClosed
            };
            node10.Nodes.Add(node11);
            node10.Nodes.Add(node12);
            node9.Nodes.Add(node10);
            FeatureNode node16 = new FeatureNode {
                Name = "DeviceIoRelayOutputsMonostable",
                Feature = Feature.DeviceIORelayOutputsMonostable
            };
            FeatureNode node17 = new FeatureNode {
                Name = "DeviceIoRelayOutputsMonostableOpen",
                Feature = Feature.DeviceIORelayOutputsMonostableOpen
            };
            FeatureNode node18 = new FeatureNode {
                Name = "DeviceIoRelayOutputsMonostableClosed",
                Feature = Feature.DeviceIORelayOutputsMonostableClosed
            };
            node16.Nodes.Add(node17);
            node16.Nodes.Add(node18);
            node9.Nodes.Add(node16);
            FeatureNode node22 = new FeatureNode {
                Name = "Events",
                Feature = Feature.EventsService
            };
            set.Nodes.Add(node22);
            FeatureNode node23 = new FeatureNode {
                Name = "Media",
                Feature = Feature.MediaService
            };
            set.Nodes.Add(node23);
            FeatureNode node24 = new FeatureNode {
                Name = "VideoCodec",
                Feature = Feature.Video,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            node23.Nodes.Add(node24);
            FeatureNode node112 = new FeatureNode {
                Name = "JPEG",
                Feature = Feature.JPEG
            };
            node24.Nodes.Add(node112);
            FeatureNode node113 = new FeatureNode {
                Name = "H264",
                Feature = Feature.H264
            };
            node24.Nodes.Add(node113);
            FeatureNode node114 = new FeatureNode {
                Name = "MPEG4",
                Feature = Feature.MPEG4
            };
            node24.Nodes.Add(node114);
            FeatureNode node25 = new FeatureNode {
                Name = "Audio",
                Feature = Feature.Audio
            };
            node23.Nodes.Add(node25);
            FeatureNode node116 = new FeatureNode {
                Name = "G711",
                Feature = Feature.G711
            };
            node25.Nodes.Add(node116);
            FeatureNode node117 = new FeatureNode {
                Name = "G726",
                Feature = Feature.G726
            };
            node25.Nodes.Add(node117);
            FeatureNode node118 = new FeatureNode {
                Name = "AAC",
                Feature = Feature.AAC
            };
            node25.Nodes.Add(node118);
            FeatureNode node26 = new FeatureNode {
                Name = "Backchannel",
                Feature = Feature.AudioOutput
            };
            node23.Nodes.Add(node26);
            FeatureNode node120 = new FeatureNode {
                Name = "BackchannelG711",
                Feature = Feature.AudioOutputG711
            };
            node26.Nodes.Add(node120);
            FeatureNode node121 = new FeatureNode {
                Name = "BackchannelG726",
                Feature = Feature.AudioOutputG726
            };
            node26.Nodes.Add(node121);
            FeatureNode node122 = new FeatureNode {
                Name = "BackchannelAAC",
                Feature = Feature.AudioOutputAAC
            };
            node26.Nodes.Add(node122);
            FeatureNode node27 = new FeatureNode {
                Name = "RTSS",
                Feature = Feature.RTSS,
                State = FeatureState.Undefined,
                Status = FeatureStatus.Group
            };
            node23.Nodes.Add(node27);
            FeatureNode node29 = new FeatureNode {
                Name = "RTPUDP",
                Feature = Feature.RTPUDP
            };
            node27.Nodes.Add(node29);
            FeatureNode node30 = new FeatureNode {
                Name = "RTPRTSPHTTP",
                Feature = Feature.RTPRTSPHTTP
            };
            node27.Nodes.Add(node30);
            FeatureNode node31 = new FeatureNode {
                Name = "RTPRTSPTCP",
                Feature = Feature.RTPRTSPTCP
            };
            node27.Nodes.Add(node31);
            FeatureNode node32 = new FeatureNode {
                Name = "RTPMulticastUDP",
                Feature = Feature.RTPMulticastUDP
            };
            node27.Nodes.Add(node32);
            FeatureNode node33 = new FeatureNode {
                Name = "SnapshotURI",
                Feature = Feature.SnapshotUri
            };
            node27.Nodes.Add(node33);
            FeatureNode node34 = new FeatureNode {
                Name = "PTZ",
                Feature = Feature.PTZService
            };
            set.Nodes.Add(node34);
            FeatureNode node35 = new FeatureNode {
                Name = "PTZAbsolute",
                Feature = Feature.PTZAbsolute
            };
            FeatureNode node44 = new FeatureNode {
                Name = "PanTiltMovement",
                Feature = Feature.PTZAbsolutePanTilt
            };
            node35.Nodes.Add(node44);
            FeatureNode node45 = new FeatureNode {
                Name = "ZoomMovement",
                Feature = Feature.PTZAbsoluteZoom
            };
            node35.Nodes.Add(node45);
            FeatureNode node36 = new FeatureNode {
                Name = "PTZRelative",
                Feature = Feature.PTZRelative
            };
            FeatureNode node47 = new FeatureNode {
                Name = "PanTiltMovement",
                Feature = Feature.PTZRelativePanTilt
            };
            node36.Nodes.Add(node47);
            FeatureNode node48 = new FeatureNode {
                Name = "ZoomMovement",
                Feature = Feature.PTZRelativeZoom
            };
            node36.Nodes.Add(node48);
            FeatureNode node37 = new FeatureNode {
                Name = "PTZContinuous",
                Feature = Feature.PTZContinious
            };
            FeatureNode node50 = new FeatureNode {
                Name = "PanTiltSpeedConfiguration",
                Feature = Feature.PTZContinuousPanTilt
            };
            node37.Nodes.Add(node50);
            FeatureNode node51 = new FeatureNode {
                Name = "ZoomSpeedConfiguration",
                Feature = Feature.PTZContinuousZoom
            };
            node37.Nodes.Add(node51);
            FeatureNode node38 = new FeatureNode {
                Name = "PTZPresets",
                Feature = Feature.PTZPresets
            };
            FeatureNode node39 = new FeatureNode {
                Name = "PTZHome",
                Feature = Feature.PTZHome
            };
            FeatureNode node54 = new FeatureNode {
                Name = "ConfigurableHomePosition",
                Feature = Feature.PTZConfigurableHome
            };
            node39.Nodes.Add(node54);
            FeatureNode node55 = new FeatureNode {
                Name = "FixedHomePosition",
                Feature = Feature.PTZFixedHome
            };
            node39.Nodes.Add(node55);
            FeatureNode node40 = new FeatureNode {
                Name = "PTZAuxiliary",
                Feature = Feature.PTZAuxiliary
            };
            FeatureNode node41 = new FeatureNode {
                Name = "PTZSpeed",
                Feature = Feature.PTZSpeed
            };
            FeatureNode node58 = new FeatureNode {
                Name = "PanTiltSpeed",
                Feature = Feature.PTZSpeedPanTilt
            };
            node41.Nodes.Add(node58);
            FeatureNode node59 = new FeatureNode {
                Name = "ZoomSpeed",
                Feature = Feature.PTZSpeedZoom
            };
            node41.Nodes.Add(node59);
            node34.Nodes.AddRange(new FeatureNode[] { node35, node36, node37, node38, node39, node40, node41 });
            FeatureNode node60 = new FeatureNode {
                Name = "IO",
                Feature = Feature.DeviceIoService
            };
            set.Nodes.Add(node60);
            FeatureNode node62 = new FeatureNode {
                Name = "RelayOutput",
                Feature = Feature.RelayOutputs
            };
            node60.Nodes.Add(node62);
            FeatureNode node63 = new FeatureNode {
                Name = "Imaging",
                Feature = Feature.ImagingService
            };
            set.Nodes.Add(node63);
            FeatureNode node65 = new FeatureNode {
                Name = "Analytics",
                Feature = Feature.AnalyticsService
            };
            set.Nodes.Add(node65);
            FeatureNode node67 = new FeatureNode {
                Name = "Recording",
                Feature = Feature.RecordingControlService
            };
            set.Nodes.Add(node67);
            FeatureNode node68 = new FeatureNode {
                Name = "DynamicRecording",
                Feature = Feature.DynamicRecording
            };
            node67.Nodes.Add(node68);
            FeatureNode node69 = new FeatureNode {
                Name = "DynamicTracks",
                Feature = Feature.DynamicTracks
            };
            node67.Nodes.Add(node69);
            FeatureNode node70 = new FeatureNode {
                Name = "AudioRecording",
                Feature = Feature.AudioRecording
            };
            node67.Nodes.Add(node70);
            FeatureNode node71 = new FeatureNode {
                Name = "MetadataRecording",
                Feature = Feature.MetadataRecording
            };
            set.Nodes.Add(node71);
            FeatureNode node77 = new FeatureNode {
                Name = "Search",
                Feature = Feature.RecordingSearchService
            };
            set.Nodes.Add(node77);
            FeatureNode node78 = new FeatureNode {
                Name = "MetadataSearch",
                Feature = Feature.MetadataSearch
            };
            node77.Nodes.Add(node78);
            FeatureNode node79 = new FeatureNode {
                Name = "PTZPositionSearch",
                Feature = Feature.PTZPositionSearch
            };
            node77.Nodes.Add(node79);
            FeatureNode node83 = new FeatureNode {
                Name = "Replay",
                Feature = Feature.ReplayService
            };
            set.Nodes.Add(node83);
            FeatureNode node84 = new FeatureNode {
                Name = "ReverseReplay",
                Feature = Feature.ReverseReplay
            };
            node83.Nodes.Add(node84);
            FeatureNode node87 = new FeatureNode {
                Name = "Receiver",
                Feature = Feature.ReceiverService
            };
            set.Nodes.Add(node87);
            return set;
        }

        public FeatureNode FindNode(Feature feature)
        {
            foreach (FeatureNode node in this.Nodes)
            {
                if (node.Feature == feature)
                {
                    return node;
                }
                FeatureNode node2 = this.FindNode(node, feature);
                if (node2 != null)
                {
                    return node2;
                }
            }
            return null;
        }

        private FeatureNode FindNode(FeatureNode node, Feature feature)
        {
            foreach (FeatureNode node2 in node.Nodes)
            {
                if (node2.Feature == feature)
                {
                    return node2;
                }
                FeatureNode node3 = this.FindNode(node2, feature);
                if (node3 != null)
                {
                    return node3;
                }
            }
            return null;
        }

        public List<FeatureNode> Nodes { get; private set; }
    }
}

